#ifndef BIMAP_H_
#define BIMAP_H_

// #include "scHeader.h"
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <utility>

// using boost::multi_index_container;
// using namespace boost::multi_index;

namespace sybilpm
{

/* A bidirectional map can be simulated as a multi_index_container
* of pairs of (FromType,ToType) with two unique indices, one
* for each member of the pair.
*/
template<typename FromType, typename ToType>
struct bidirectional_map
{
	struct FromTag{};
	struct ToTag{};
	typedef std::pair<FromType, ToType> value_type;
	typedef boost::multi_index_container<value_type, boost::multi_index::indexed_by<
		boost::multi_index::ordered_unique<
			boost::multi_index::tag<FromTag>, boost::multi_index::member<value_type,FromType,&value_type::first> >,
		boost::multi_index::ordered_unique<
			boost::multi_index::tag<ToTag>, boost::multi_index::member<value_type,ToType,&value_type::second> > >
		> type;
};

} // namespace sybilpm

#endif /* BIMAP_H_ */
